package com.ztmg.water.controller.order;

import com.ztmg.common.util.resultUtils.JsonResult;;
import com.ztmg.water.dto.base.DeliveryManDTO;
import com.ztmg.water.dto.bills.OutPutBillsDTO;
import com.ztmg.water.model.bills.OutPutBills;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import com.github.pagehelper.PageInfo;


import com.ztmg.water.vo.order.OrderWaterVO;
import com.ztmg.water.dto.order.OrderWaterDTO;
import com.ztmg.water.dto.order.OrderWaterPageDTO;
import com.ztmg.water.service.order.OrderWaterService;

import java.util.List;


/**
 * 
 * OrderWaterControllerController
 * 
 **/

@Api(description = "桶装水订单接口")
@RestController
@RequestMapping(value = "/orderWater")
public class OrderWaterController{

	@Resource
	private OrderWaterService orderWaterService;

    @PostMapping("selectListByDeliveryMan")
    @ApiOperation("根据送水人员查询对应的区域订单")
    public JsonResult<List<OrderWaterVO>> selectListByDeliveryMan(@RequestBody DeliveryManDTO dto){
        return orderWaterService.selectOrderListByDeliveryMan(dto);
    }
    @PostMapping("selectCountByDeliveryMan")
    @ApiOperation("查询订单数量")
    public JsonResult selectCountByDeliveryMan(@RequestBody DeliveryManDTO dto){
        return orderWaterService.selectCountOrderListByDeliveryMan(dto);
    }
    @PostMapping("selectListByOrderId")
    @ApiOperation("根据送水人员查询对应的区域订单")
    public JsonResult<List<OrderWaterVO>> selectListByOrderId(@RequestBody OutPutBillsDTO dto){
        return orderWaterService.selectOrderListByOrderID(dto);
    }
    @PostMapping("create")
    @ApiOperation("新增")
    public JsonResult create(@RequestBody OrderWaterDTO dto){
        return orderWaterService.create(dto);
    }

    @PostMapping("update")
    @ApiOperation("修改")
    public JsonResult update(@RequestBody OrderWaterDTO dto){
        return orderWaterService.update(dto);
    }

    @GetMapping("detail/{id}")
    @ApiOperation("详情")
    public JsonResult<OrderWaterVO> detail(@PathVariable Integer id){
        return orderWaterService.selectById(id);
    }

    @PostMapping("select")
    @ApiOperation("条件查询")
    public JsonResult<OrderWaterVO> detail(@RequestBody OrderWaterDTO dto){
        return orderWaterService.select(dto);
    }

    @PostMapping("queryPage")
    @ApiOperation("分页查询")
    public JsonResult<PageInfo<OrderWaterVO>> queryPage(@RequestBody OrderWaterPageDTO dto){
        return orderWaterService.selectPage(dto);
    }

    @PostMapping("delete")
    @ApiOperation("条件删除")
    public JsonResult delete(@RequestBody OrderWaterDTO dto){
        return orderWaterService.delete(dto);
    }

    @GetMapping("deleteById/{id}")
    @ApiOperation("删除")
    public JsonResult deleteById(@PathVariable Integer id){
        return orderWaterService.deleteById(id);
    }

}